package com.foreknow.demo4;

/**
 * 用方法来实现1+2+.....10的和
 */
public class TestMethod2 {
    public static void sum(int n) {
        int sum = 0;
        for(int i = 1;i<=n;i++){
            sum+=i;
        }
        System.out.println(sum);
    }

    public static void main(String[] args) {
        TestMethod2.sum(100);
    }

}
